"""
ASGI config for LivingPic project.

It exposes the ASGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""

import os
from django.core.asgi import get_asgi_application
from channels.routing import ProtocolTypeRouter, URLRouter
from . import routing


os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'LivingPic.settings')

# application = get_asgi_application()

application = ProtocolTypeRouter({
    # http请求使用这个
    "http": get_asgi_application(),  # 自动找urls.py处理http，和刚开始学django是一样的

    # websocket请求使用这个
    "websocket": URLRouter(routing.websocket_urlpatterns)  # routing相当于urls
})